<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>修改密码</title>
    <!--css style-->
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="responsive/flexible.css">
    <script src="responsive/flexible.js"></script>
</head>
<body class="personal_center bind pwd">
    <header>
        <a href="javascript:void(0)" class="pre_page"></a>
        修改密码
    </header>

    <section class="main">
        <div class="container">

            <ol class="vip_ctr_header" type="1">
                <li class="active"><span>1</span><a href="javascript:void(0)">验证身份</a></li>
                <li><span>2</span><a href="javascript:void(0)">修正密码</a></li>
            </ol>
            <form action="pwd_edit1.html" class="form_pwd">
                <h2>已绑定手机：138****2563  <input type="button" class="get_code" id="get_code" onclick="checkCode()" value="获取短信验证码"></h2>

                <p>短信已经发送到您的手机上，如在 <span>120</span>秒内还没有收到
                        短信验证码，请重新获取验证</p>

                <h2>请输入短信验证码</h2>
                <input type="text" id="valid_code"  onblur="checkValidCode(this)">
                <p class="red">请输入正确的短信验证码</p>
                <input type="submit" value="下一步" id="next_step" onclick="checkInfo()">
            </form>
        </div>
    </section>


</body>
<script src="js/jquery.js"></script>
<script>
    /*检测是否为空*/
    function checkEmpty(obj,message){
        if(obj.value==''){
            alert(message);
            return true;
        }else{
            return false;
        }
    }
    /*get code*/
    function checkCode(){
        var obj=document.getElementById("valid_code");
        //console.log(obj)
        obj.code="123";
        //console.log(obj.code);
    }
    /*检验验证码*/
    function checkValidCode(obj){
        obj.errorFlag = false;

        if (checkEmpty(obj,'请您填写验证码')) {
            obj.errorFlag = true;
            return  obj.errorFlag;
        }
        //console.log(obj.value+":"+obj.code);
        if(obj.value!=obj.code){
            alert("输入验证码不正确");
            $("p.red").show();
            obj.errorFlag = true;
        }else{
            $("p.red").hide();
        }

        return  obj.errorFlag;
    }
    function checkInfo() {
        var elCode=document.getElementById("valid_code");
        if(checkValidCode(elCode)){
            $(".form_pwd").submit(false);
            $("p.red").show();
        }else{
            $("p.red").hide();
        }
    }

</script>
</html>